import {GameVar} from "../scripts/game/GameVar";
import {wxUtils} from "../scripts/wx/wxUtils";

const mta = require('./mta_analysis')

export enum StatEvent {
  NN = 0,
  GAME_PLAY = 1,
  BTN_LIMIT = 2,
  BTN_INFI = 3,
  BTN_SHOP = 4,
  BTN_RANK = 5,
  BTN_BOX = 6,
  BTN_NEWBIE = 7,
  BTNSHARE = 8,
  BTN_SEVEN = 9,
  BTN_SWIM_GET = 10,
  BTN_HEAD_GET = 11,
  LIMIT_TIME = 12,
  INFI_TIME = 13,
  GRADE_CLICK = 16,
  GROUP_RANK_CLICK = 17,
  INVITE_CLICK = 18,
  LUCKY_CLICK = 19,
}

export class Statistic {
  public static init() {
    mta.App.init({
      "appID": "500631984",
      "eventID": "500631985",
    });
  }

  public static emit(event: StatEvent, value?: any) {
    if (!wxUtils.isWechat) {
      return
    }
    const param = {...value, uid: GameVar.userInfo.uid}
    mta.Event.stat(event.toString(), param)
  }
}